package com.example.doubledb.web;


import com.example.doubledb.entity.User;
import com.example.doubledb.service.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("user")
public class UserController {

    private final UserService userService;


    @GetMapping("test")
    public List<User> test(String name) {
        return null ;
    }


    @GetMapping()
    public List<User> query(User userBo) {
        List<User> result = userService.selectList(userBo);
        return result;
    }


    @PostMapping()
    public String add(@RequestBody User userBo) {
        return " user:add success";
    }

    @PutMapping()
    public String edit(@RequestBody User userBo) {
        return " user:edit success";
    }

    @DeleteMapping()
    public String remove() {
        return "delete success!";
    }


}
